{include file="kuyou/common/menu" /}
<style>
    #main, .tab-content, #content {
        height: 100%;
    }

    #content .row {
        height: 100%;
    }

    #content > .row > .col-xs-12 {
        height: 100%;
    }

    #content > .row > .col-xs-12 > .content {
        height: 100%;
    }

    #add-form {
        height: 100%;
    }

    .content {
        padding: 0;
    }

    .header_div {
        height: 60px;
        display: flex;
        box-sizing: border-box;
        border-bottom: 1px solid #006de0;
        background: #0f86ea;
        color: #f5f5f5;
    }

    .header_div .header_box {
        width: 100%;
    }

    .customers_div {
        float: right;
        width: 150px;
        margin-right: 40px;
        margin-top: 15px;
    }

    .company_name {
        float: left;
        min-width: 150px;
        line-height: 60px;
        margin-left: 20px;
    }


    .el-footer {
        padding-top: 12px;
        background: #fff;
        -webkit-box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        position: fixed;
        width: 100%;
        bottom: 0;
    }

    .el-footer {
        padding: 0 20px;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    .el-row {
        position: relative;
    }

    .el-col {
        float: left;
    }

    .el-col-20 {
        width: 83.33333%;
    }

    .el-col-4 {
        width: 16.66667%;
    }

    .el-button-group {
        display: inline-block;
        vertical-align: middle;
    }

    .el-button {
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        background: #fff;
        border: 1px solid #dcdfe6;
        color: #606266;
        -webkit-appearance: none;
        text-align: center;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        outline: 0;
        margin: 0;
        -webkit-transition: .1s;
        transition: .1s;
        font-weight: 500;
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 4px;
    }

    .el-button--info {
        color: #fff;
        background-color: #909399;
        border-color: #909399;
    }

    .el-button--medium {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 4px;
    }

    .el-button-group > .el-button {
        position: relative;
    }

    .el-button-group > .el-button:first-child {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }

    .el-button-group > .el-button:not(:last-child) {
        margin-right: -1px;
    }

    .el-button-group .el-button--info:first-child {
        border-right-color: hsla(0, 0%, 100%, .5);
    }

    .btnGroupPopover {
        position: relative;
        margin-left: 1px;
    }

    .el-button--primary {
        color: #fff;
        background-color: #409eff;
        border-color: #409eff;
    }

    .el-button--medium {
        padding: 10px 20px;
        font-size: 14px;
        border-radius: 4px;
    }

    .el-popover__reference {
        border-radius: 0 4px 4px 0;
        margin-left: -3px;
    }
</style>
<style>
    td {
        border: 0px;
    }

    .retail_content {
        height: calc(100% - 120px);
    }

    .rc_table {
        width: 100%;
        height: 100%;
        min-width: 750px;
    }

    .rc_left {
        width: 450px;
    }

    .rc_right {
        width: calc(100% - 350px);
        min-width: 350px;
    }

    .goods_box {
        box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        width: calc(100% - 30px);
        height: calc(100% - 30px);
        background: white;
        margin-left: 15px;
        border-radius: 4px;
        overflow-y: auto;
    }

    .goods_list {
        box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        width: calc(100% - 15px);
        height: calc(100% - 30px);
        background: white;
        border-radius: 4px;
    }

    .gb_title {
        height: 40px;
        border-bottom: 1px solid #ebeef5;
        padding: 0 20px;
        line-height: 40px;
        text-align: left;
        overflow: hidden;
    }

    .del_all {
        float: right;
        width: 20px;
        cursor: pointer;
        height: 20px;
        margin-top: 10px;
        line-height: 20px;
    }

    .gb_list {
        padding: 10px;
        overflow-y: auto;
    }

    .gb_count {
        height: 40px;
        border-top: 1px solid #ebeef5;
        padding: 0 20px;
        line-height: 40px;
        text-align: left;
    }

    .gb_count_price {
        float: right;
        color: #ff6a23;
    }

    .gb_list table {
        width: 100%;
    }

    .gb_list table tr {
        border-bottom: 1px solid #ebeef5;
    }

    .gb_list th {
        color: #909399;
    }

    .gb_list td {
        color: #606266;
    }

    .gb_list th, .gb_list td {
        text-align: center;
        line-height: 20px;
        padding: 10px 0;
    }

    .gb_list tbody tr:hover {
        background: #f4f5f7;
    }

    .gb_list .active {
        background: #f4f5f7;
    }

    .goods_price_box {
        text-align: left;
        line-height: 30px;
        height: 28px;
        overflow: hidden;
        padding-right: 50px;
        position: relative;
    }

    .goods_price {
        float: right;
        color: #ff6a23;
        position: absolute;
        right: 0;
        top: 0;
        background: #fff;
        padding-left: 5px
    }

    .goods_title {
        height: 200px;
        background: #f5f7fa;
        line-height: 200px;
        text-align: center;
    }

    .goods_info {
        padding: 10px;
        box-sizing: border-box;
        cursor: pointer;
        box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        border-radius: 4px;
        margin-bottom: 20px;
        position: relative;
        border: solid 1px #fff;
    }

    .gl_list {
        margin: 0;
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        height: 700px !important;
    }

    /*.gl_list,.gb_list{*/
    /*height: 700px!important;*/
    /*}*/
    .page_box {
        line-height: 40px;
    }

    .page_box span {
        padding: 5px;
        color: #606266;
    }

    .page_box span a {
        color: #606266;
        font-size: 14px;
    }

    .page_box span i {
        color: #606266;
        font-size: 14px;
    }

    .page_box span .page:hover {
        color: #0f86ea;
    }

    .page_box span .page:hover i {
        color: #0f86ea;
    }

    .page_box .active {
        color: #0f86ea;
    }

    .page_box .active i {
        color: #0f86ea;
    }

    .search_div {
        float: right;
        height: 40px;
        line-height: 40px;
        position: relative;
    }

    .search_div input {
        height: 28px;
        margin-top: 7px;
        border: solid 1px #b7b7b7;
        position: absolute;
        right: 37px;
    }

    .search_div span {
        display: inline-block;
        padding: 5px 10px;
        height: 28px;
        line-height: 20px;
        margin-top: 7px;
        margin-left: -1px;
        border-radius: 0px 3px 3px 0px;
        border: solid 1px #b7b7b7;
        background: #e5e5e5;
        cursor: pointer;
    }

    .goods_title img {
        max-width: 100%;
    }

    .goods_unit, .goods_attr {
        position: absolute;
        width: calc(100% - 30px);
        height: calc(100% - 20px);
        z-index: 1;
        top: 0;
        left: 15px;
        background: #fff;
        padding: 10px;
        text-align: left;
        border-radius: 4px;
        box-sizing: border-box;
        border: solid 1px #fff;
    }

    .goods_attr {
        z-index: 2;
    }

    .goods_name {
        line-height: 30px;
        padding: 0 10px;
    }

    .goods_line {
        border-bottom: solid 1px #dbdee5;
    }

    .gu_info {
        line-height: 20px;
        padding: 0 10px;
    }

    .gui_list {
        border: solid 1px #dbdee5;
        margin: 10px 0;
        padding: 0 5px;
        cursor: pointer;
    }

    .gu_info .active {
        border: solid 1px #aaadb4;
    }

    .disnone {
        display: none;
    }

    #gb_list_info span {
        cursor: pointer;
    }

    .current {
        box-sizing: border-box;
        border: solid 1px #aaadb4;
    }
</style>
<style>
    .el-popover {
        position: absolute;
        background: #fff;
        min-width: 150px;
        border: 1px solid #ebeef5;
        padding: 12px;
        z-index: 2000;
        color: #606266;
        line-height: 1.4;
        text-align: justify;
        font-size: 14px;
        -webkit-box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        word-break: break-all;
    }

    .listPopover {
        padding: 6px 12px;
    }

    .el-popper[x-placement^=top] {
        margin-bottom: 12px;
    }

    .el-popper .popper__arrow, .el-popper .popper__arrow:after {
        position: absolute;
        display: block;
        width: 0;
        height: 0;
        border-color: transparent;
        border-style: solid;
    }

    .el-popper .popper__arrow {
        border-width: 6px;
        -webkit-filter: drop-shadow(0 2px 12px rgba(0, 0, 0, .03));
        filter: drop-shadow(0 2px 12px rgba(0, 0, 0, .03));
    }

    .el-popper[x-placement^=top] .popper__arrow {
        bottom: -6px;
        left: 50%;
        margin-right: 3px;
        border-top-color: #fff;
        border-bottom-width: 0;
    }

    .listPopover ul {
        overflow: auto;
        max-height: 135px;
        list-style-type: none;
    }

    .pendList[data-v-94c2cff2] {
        outline: none;
    }

    .listPopover li {
        line-height: 32px;
        border-bottom: 1px solid #ccc;
        padding: 0 10px;
        cursor: pointer;
    }

    .listPopover li i {
        margin-left: 10px;
    }

    .listPopover li:last-of-type {
        border-bottom: none;
    }

    .pendList li[data-v-94c2cff2] {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between;
        -ms-flex-line-pack: justify;
        align-content: space-between;
    }

    .pendList .pendFocus[data-v-94c2cff2] {
        background: #f4f5f7;
    }
</style>
<style>
    .vposModal[data-v-94c2cff2] {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        opacity: .2;
        background: #000;
        z-index: 2;
        width: 100%;
        height: 100%;
    }

    .el-popper[x-placement^=right] .popper__arrow {
        top: 50%;
        left: -6px;
        margin-bottom: 3px;
        border-right-color: #ebeef5;
        border-left-width: 0;
    }

    .form .title[data-v-94c2cff2] {
        padding: 10px;
        background: #fdfdfd;
        border-bottom: 1px solid #c1c1c1;
    }

    .vposFormPopover {
        padding: 0;
        border-radius: 4px;
    }

    .form .el-form[data-v-94c2cff2] {
        max-height: calc(100vh - 208px);
        overflow-x: hidden;
        overflow-y: auto;
        padding: 10px 12px;
    }

    .form .el-form-item[data-v-94c2cff2] {
        width: 250px;
        margin-bottom: 14px;
    }

    .el-form-item__label {
        text-align: right;
        vertical-align: middle;
        float: left;
        font-size: 14px;
        color: #606266;
        line-height: 40px;
        padding: 0 12px 0 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    .el-form-item--small .el-form-item__label {
        line-height: 32px;
    }

    .el-form-item__content {
        line-height: 40px;
        position: relative;
        font-size: 14px;
    }

    .el-form-item--small .el-form-item__content, .el-form-item--small .el-form-item__label {
        line-height: 32px;
    }

    .el-input {
        position: relative;
        font-size: 14px;
        display: inline-block;
        width: 100%;
    }

    .el-input--small {
        font-size: 13px;
    }

    .el-input__inner {
        -webkit-appearance: none;
        background-color: #fff;
        background-image: none;
        border-radius: 4px;
        border: 1px solid #dcdfe6;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        color: #606266;
        display: inline-block;
        font-size: inherit;
        height: 40px;
        line-height: 40px;
        outline: 0;
        padding: 0 15px;
        -webkit-transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
        transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
        width: 100%;
    }

    .el-input--small .el-input__inner {
        height: 32px;
        line-height: 32px;
    }

    .el-input.is-disabled .el-input__inner {
        background-color: #f5f7fa;
        border-color: #e4e7ed;
        color: #c0c4cc;
        cursor: not-allowed;
    }
</style>
<style>
    .el-dialog {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        margin: 0 auto;
        border-radius: 5px;
        -webkit-background-clip: content;
        border: 6px solid rgba(0, 0, 0, .3);
        -webkit-box-shadow: 1px 1px 50px rgb(0 0 0 / 30%);
        box-shadow: 1px 1px 50px rgb(0 0 0 / 30%);

        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }

    .el-dialog .el-dialog__header {
        padding: 12px;
        background-color: #f8f8f8;
        border-bottom: 1px solid #eee;
    }

    .el-dialog__title {
        line-height: 24px;
        font-size: 18px;
        color: #303133;
    }

    .el-dialog .el-dialog__header .el-dialog__title {
        font-size: 14px;
        line-height: 18px;
    }

    .el-dialog__headerbtn {
        position: absolute;
        top: 20px;
        right: 20px;
        padding: 0;
        background: 0 0;
        border: none;
        outline: 0;
        cursor: pointer;
        font-size: 16px;
    }

    .el-dialog .el-dialog__header .el-dialog__headerbtn {
        top: 14px;
    }

    .el-dialog__body {
        padding: 10px 10px;
        color: #606266;
        font-size: 14px;
        word-break: break-all;
    }

    .el-dialog .el-dialog__body {
        -webkit-box-flex: 1;
        -ms-flex: 1;
        flex: 1;
        overflow: auto;
        padding: 12px;
    }

    .panel[data-v-94c2cff2] {
        outline: none;
    }

    .el-col-md-8 {
        width: 33.33333%;
    }

    .el-col-md-16 {
        width: 66.66667%;
    }

    .el-card, .el-message {
        border-radius: 4px;
        overflow: hidden;
    }

    .el-card {
        border: 1px solid #ebeef5;
        background-color: #fff;
        color: #303133;
        -webkit-transition: .3s;
        transition: .3s;
        height: 286px;
    }

    .el-card__header {
        padding: 18px 20px;
        border-bottom: 1px solid #ebeef5;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    .panel[data-v-94c2cff2] .el-card__header {
        padding: 9px 12px;
    }

    .el-form-item__label {
        text-align: right;
        vertical-align: middle;
        float: left;
        font-size: 14px;
        color: #606266;
        line-height: 40px;
        padding: 0 12px 0 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    }

    .el-form-item--small .el-form-item__label {
        line-height: 32px;
    }

    .el-form-item__content {
        line-height: 40px;
        position: relative;
        font-size: 14px;
    }

    .el-form-item--small .el-form-item__content, .el-form-item--small .el-form-item__label {
        line-height: 32px;
    }

    .el-input {
        position: relative;
        font-size: 14px;
        display: inline-block;
        width: 100%;
    }

    .el-input--small {
        font-size: 13px;
    }

    .el-input__inner {
        -webkit-appearance: none;
        background-color: #fff;
        background-image: none;
        border-radius: 4px;
        border: 1px solid #dcdfe6;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        color: #606266;
        display: inline-block;
        font-size: inherit;
        height: 40px;
        line-height: 40px;
        outline: 0;
        padding: 0 15px;
        -webkit-transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
        transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
        width: 100%;
    }

    .el-input--small .el-input__inner {
        height: 32px;
        line-height: 32px;
    }

    .el-input.is-disabled .el-input__inner {
        background-color: #f5f7fa;
        border-color: #e4e7ed;
        color: #c0c4cc;
        cursor: not-allowed;
    }

    .panel[data-v-94c2cff2] .el-card__body {
        padding: 12px;
    }

    .el-tabs--border-card {
        background: #fff;
        border: 1px solid #dcdfe6;
        -webkit-box-shadow: 0 2px 4px 0 rgb(0 0 0 / 12%), 0 0 6px 0 rgb(0 0 0 / 4%);
        box-shadow: 0 2px 4px 0 rgb(0 0 0 / 12%), 0 0 6px 0 rgb(0 0 0 / 4%);
    }

    .el-tabs--left, .el-tabs--right {
        overflow: hidden;
    }

    .panel .paymentTabs[data-v-94c2cff2] {
        height: 286px;
        border-radius: 4px;
    }

    .el-tabs__content {
        overflow: hidden;
        position: relative;
    }

    .el-tabs--border-card > .el-tabs__content {
        padding: 15px;
    }

    .panel[data-v-94c2cff2] .el-tabs__content {
        padding: 12px;
    }

    .panel .cashList[data-v-94c2cff2] {
        padding: 6px 0;
        border-radius: 4px;
        background: #f5f7fa;
        border: 1px solid #dcdfe6;
        list-style-type: none;
        color: #303133;
        height: 65px;
    }

    .panel .cashList li[data-v-94c2cff2] {
        float: left;
        width: 33%;
        text-align: center;
    }

    .panel .cashList span[data-v-94c2cff2] {
        line-height: 24px;
        font-weight: 700;
    }

    .panel .cashList p[data-v-94c2cff2] {
        height: 24px;
        line-height: 24px;
        font-size: 20px;
        margin-top: 2px;
    }

    .panel .cashList p[data-v-94c2cff2] {
        height: 24px;
        line-height: 24px;
        font-size: 20px;
        margin-top: 2px;
    }

    .panel .cashList input[data-v-94c2cff2] {
        width: 100%;
        background: #f5f7fa;
        border: none;
        height: 24px;
        font-size: 20px;
        outline: none;
        text-align: center;
        border-bottom: 1px solid #dcdfe6;
    }

    .panel .board[data-v-94c2cff2] {
        margin-top: 9px;
    }

    .panel .board ul[data-v-94c2cff2] {
        list-style: none;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border-top: 1px solid #dcdfe6;
        border-left: 1px solid #dcdfe6;
    }

    .panel .board li[data-v-94c2cff2] {
        float: left;
        width: 25%;
        cursor: pointer;
        font-size: 12px;
        font-weight: 700;
        line-height: 46px;
        text-align: center;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border-right: 1px solid #dcdfe6;
        border-bottom: 1px solid #dcdfe6;
    }

    .panel .board li[data-v-94c2cff2] {
        float: left;
        width: 25%;
        cursor: pointer;
        font-size: 12px;
        font-weight: 700;
        line-height: 46px;
        text-align: center;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        border-right: 1px solid #dcdfe6;
        border-bottom: 1px solid #dcdfe6;
    }

    .panel .board .stress[data-v-94c2cff2] {
        width: 50%;
        color: #fff;
        margin-top: -1px;
        margin-left: -1px;
        background: #51a7ff;
        -webkit-box-sizing: initial;
        box-sizing: initial;
        border-right: 1px solid #51a7ff;
        border-bottom: 2px solid #51a7ff;
    }

    .account_s {
        border-radius: 4px;
        border: 1px solid #dcdfe6;
        height: 32px;
        line-height: 32px;
    }

    .panel {
        border: 0;
    }
</style>
<div id="add-form" class="form-horizontal" role="form" data-toggle="validator">
    <div class="header_div">
        <div class="header_box">
            <div class="company_name">{$company_name|default=''}</div>
            <div class="customers_div">
                <div class="form-group">
                    <div class="col-xs-12 col-sm-12">
                        <input type="hidden" id="customers_id" value="">
                        <input type="hidden" id="customers_name" value="">
                        <div id="customers_ids" class="xm-select-demo"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="retail_content">
        <table class="rc_table">
            <tr>
                <td class="rc_left">
                    <div class="goods_box">
                        <div class="gb_title">商品信息<span class="del_all" onclick="cancelGoods()"><i class="layui-icon">&#xe640;</i></span>
                        </div>
                        <div class="gb_list" id="gb_list">
                            <table>
                                <thead>
                                <tr>
                                    <th>商品名称</th>
                                    <th>数量</th>
                                    <th>金额</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody id="gb_list_info">
                                </tbody>
                            </table>
                        </div>
                        <div class="gb_count">合计<span class="gb_count_number">0</span>项<span
                                class="gb_count_price">0元</span></div>
                    </div>
                </td>
                <td class="rc_right">
                    <div class="goods_list">
                        <div class="gb_title">商品列表
                            <div class="search_div"><input id="keyword" placeholder="请输入搜索内容"><span
                                    class="search_btn"><i class="layui-icon">&#xe615;</i></span></div>
                        </div>
                        <div class="gl_list" id="gl_list">
                            <div class="row" id="gl_list_info">
                            </div>
                        </div>
                        <div class="page_box">
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <footer class="el-footer" style="height: 60px;">
        <div class="el-row" style="line-height: 60px;">
            <div class="el-col el-col-20">
                <div class="el-button-group">
                    <button type="button" class="el-button el-button--info el-button--medium" onclick="hanging()"><span>F7 挂单</span>
                    </button>
                    <button type="button" class="el-button el-button--info el-button--medium el-popover__reference"
                            onclick="hanged()" tabindex="0"><span>F8 源单</span></button>
                </div>
            </div>
            <div class="el-col el-col-4" style="text-align: right;">
                <button type="button" class="el-button el-button--primary el-button--medium" id="checkouts"
                        onclick="checkouts()">
                    <span>F9 结账</span></button>
            </div>
        </div>
    </footer>
    <div role="tooltip" id="el-popover-3788" aria-hidden="false" class="el-popover el-popper listPopover" tabindex="0"
         style="transform-origin: center bottom; z-index: 2013; position: absolute; top: 831px; left: 82px;display: none"
         x-placement="top">
        <ul data-v-94c2cff2="" tabindex="-1" class="pendList">
        </ul>
        <div class="popper__arrow" style="left: 80.5px;"></div>
    </div>
    <div data-v-94c2cff2="" class="vposModal" style="display: none"></div>
    <div role="tooltip" id="el-popover-8738" aria-hidden="false" class="el-popover el-popper vposFormPopover"
         tabindex="0"
         style="transform-origin: left center; z-index: 2008; position: absolute; top: 75px; left: 458px;display: none"
         x-placement="right-start">
        <div data-v-94c2cff2="" tabindex="-1" class="form">
            <p data-v-94c2cff2="" class="title">商品参数</p>
            <form data-v-94c2cff2="" class="el-form">
                <div data-v-94c2cff2="" class="el-form-item el-form-item--small">
                    <label class="el-form-item__label" style="width: 80px;">商品名称</label>
                    <div class="el-form-item__content" style="margin-left: 80px;">
                        <div data-v-94c2cff2="" class="el-input el-input--small is-disabled">
                            <input type="text" id="goods_name" disabled="disabled" autocomplete="off"
                                   class="el-input__inner">
                        </div>
                    </div>
                </div>
                <div data-v-94c2cff2="" class="el-form-item is-required el-form-item--small">
                    <label for="price" class="el-form-item__label" style="width: 80px;">单价</label>
                    <div class="el-form-item__content" style="margin-left: 80px;">
                        <div data-v-94c2cff2="" class="el-input el-input--small el-input--suffix">
                            <input type="text" id="goods_price" autocomplete="off" placeholder="请输入单价"
                                   class="el-input__inner">
                        </div>
                    </div>
                </div>
                <div data-v-94c2cff2="" class="el-form-item is-required el-form-item--small">
                    <label for="nums" class="el-form-item__label" style="width: 80px;">数量</label>
                    <div class="el-form-item__content" style="margin-left: 80px;">
                        <div data-v-94c2cff2="" class="el-input el-input--small el-input--suffix">
                            <input type="text" id="goods_number" autocomplete="off" placeholder="请输入数量"
                                   class="el-input__inner">
                        </div>
                    </div>
                </div>
                <div data-v-94c2cff2="" class="el-form-item el-form-item--small">
                    <label class="el-form-item__label" style="width: 80px;">总价</label>
                    <div class="el-form-item__content" style="margin-left: 80px;">
                        <div data-v-94c2cff2="" class="el-input el-input--small is-disabled">
                            <input type="text" id="all_money" disabled="disabled" autocomplete="off"
                                   class="el-input__inner">
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div x-arrow="" class="popper__arrow" style="top: 8px;"></div>
    </div>

    <div id="js_div" style="display: none"></div>

    <style>
        .el-dialog__body {
            padding: 30px 20px;
            color: #606266;
            font-size: 14px;
            word-break: break-all;
        }

        .el-dialog .el-dialog__body {
            -webkit-box-flex: 1;
            -ms-flex: 1;
            flex: 1;
            overflow: auto;
            padding: 12px;
        }

        .panel[data-v-94c2cff2] {
            outline: none;
        }

        .panel .mouth[data-v-94c2cff2] {
            width: 100%;
            height: 24px;
            border-radius: 3px;
            background: #b3b3b3;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            border: 6px solid #e4e4e4;
        }

        .panel .paper[data-v-94c2cff2] {
            margin: 0 auto;
            font-size: 12px;
            margin-top: -14px;
            padding: 6px 10px;
            border-radius: 3px;
            width: calc(100% - 24px);
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            background-color: #fff;
            border: 1px solid #ebeef5;
            -webkit-box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
            box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
        }

        .panel .paper > [data-v-94c2cff2] {
            line-height: 24px;
        }

        .panel .paper .title[data-v-94c2cff2] {
            text-align: center;
        }

        .panel .paper > [data-v-94c2cff2] {
            line-height: 24px;
        }

        .panel .paper .distribute[data-v-94c2cff2] {
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-pack: justify;
            -ms-flex-pack: justify;
            justify-content: space-between;
            -ms-flex-line-pack: justify;
            align-content: space-between;
        }

        .panel[data-v-94c2cff2] .el-card__body {
            padding: 12px;
        }

        .panel .finish[data-v-94c2cff2] {
            margin: 14px 0;
            text-align: center;
        }

        .panel .finish i {
            font-size: 40px;
            color: #bedaaa;
            padding: 10px;
        }

        .panel .finish p[data-v-94c2cff2] {
            font-size: 16px;
            letter-spacing: 6px;
            margin: 12px 0 20px 0;
        }
        .stiJsViewerPage td{
            Font: 10pt SimSun;
        }
        .s27a3d36e {
            Font: 10pt SimSun;
            border: 0px;
            text-align: left;
            vertical-align: middle;
            white-space: nowrap;
            overflow: hidden;
        }
        .xm-input{
            color: grey;
        }
    </style>
    <div role="dialog" aria-modal="true" aria-label="结账" class="el-dialog"
         style="margin-top: 15vh; width: 660px;display: none" id="success_text">
        <div class="el-dialog__body">
            <div data-v-94c2cff2="" class="panel">
                <div data-v-94c2cff2="" class="el-row" style="margin-left: -6px; margin-right: -6px;">
                    <div data-v-94c2cff2="" class="el-col el-col-24 el-col-md-8"
                         style="padding-left: 6px; padding-right: 6px;">
                        <div data-v-94c2cff2="" class="mouth"></div>
                        <div data-v-94c2cff2="" class="paper"><p data-v-94c2cff2="" class="title"
                                                                 id="purchase_code"></p>
                            <hr data-v-94c2cff2="">
                            <p data-v-94c2cff2="" class="distribute"><span data-v-94c2cff2="">单据金额</span><span
                                    data-v-94c2cff2="" id="djje"></span></p>
                            <p data-v-94c2cff2="" class="distribute"><span data-v-94c2cff2="">实际金额</span><span
                                    data-v-94c2cff2="" id="sjje"></span></p>
                            <p data-v-94c2cff2="" class="distribute"><span data-v-94c2cff2="">付款方式</span><span
                                    data-v-94c2cff2="">现金</span></p>
                            <p data-v-94c2cff2="" class="distribute"><span data-v-94c2cff2="">收款金额</span><span
                                    data-v-94c2cff2="" id="skje"></span></p>
                            <p data-v-94c2cff2="" class="distribute"><span data-v-94c2cff2="">找零金额</span><span
                                    data-v-94c2cff2="" style="color: rgb(255, 0, 0);" id="zlje"></span></p></div>
                    </div>
                    <div data-v-94c2cff2="" class="el-col el-col-24 el-col-md-16"
                         style="padding-left: 6px; padding-right: 6px;">
                        <div data-v-94c2cff2="" class="el-card finishCard is-always-shadow" style="height: 190px;">
                            <!---->
                            <div class="el-card__body">
                                <div data-v-94c2cff2="" class="finish"><i class="layui-icon">&#x1005;</i>
                                    <p data-v-94c2cff2="">收款成功</p>
                                    <div data-v-94c2cff2="" class="operate">
                                        <button data-v-94c2cff2="" onclick="doPrint()" type="button"
                                                class="el-button el-button--primary el-button--small"><!---->
                                            <!----><span>F10 打印小票</span></button>
                                        <button data-v-94c2cff2="" onclick="layer.closeAll();" type="button"
                                                class="el-button el-button--success el-button--small"><!---->
                                            <!----><span>ESC 完成收银</span></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="prints" style="display: none">
        <div class="stiJsViewerPage" id="stiJsViewerPage"
             style="overflow: hidden; margin: 10px; display: inline-block; text-align: left; vertical-align: top; padding: 8px; border: 1px solid gray; color: rgb(0, 0, 0); background: white; box-sizing: content-box;">
            <table cellspacing="0" cellpadding="0" border="0"
                   style="border-width:0px;width:204px;border-collapse:collapse;">
                <tr style="height:4px;">
                    <td class="s361baff1" colspan="8" style="white-space:nowrap;height:4px;width:204px;"></td>
                </tr>
                <tr style="height:4px;">
                    <td style="border:0px;height:4px;width:8px;"></td>
                    <td style="border:0px;height:4px;width:64px;"></td>
                    <td style="border:0px;height:4px;width:10px;"></td>
                    <td style="border:0px;height:4px;width:46px;"></td>
                    <td style="border:0px;height:4px;width:4px;"></td>
                    <td style="border:0px;height:4px;width:26px;"></td>
                    <td style="border:0px;height:4px;width:39px;"></td>
                    <td style="border:0px;height:4px;width:7px;"></td>
                </tr>
                <tr style="height:22px;">
                    <td style="border:0px;height:22px;width:8px;"></td>
                    <td style="border:0px;height:22px;width:64px;"></td>
                    <td class="sd7e1d5d5" colspan="3"
                        style="white-space:nowrap;height:22px;width:60px;max-height:22px;max-width:60px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        零售单
                    </td>
                    <td style="border:0px;height:22px;width:26px;"></td>
                    <td style="border:0px;height:22px;width:39px;"></td>
                    <td style="border:0px;height:22px;width:7px;"></td>
                </tr>
                <tr style="height:8px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:8px;white-space:nowrap;height:8px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:15px;">
                    <td class="saa799430" id="print_code" colspan="8"
                        style="max-width:204px;max-height:15px;white-space:nowrap;height:15px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">

                    </td>
                </tr>
                <tr style="height:7px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:7px;white-space:nowrap;height:7px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:23px;">
                    <td style="border:0px;height:23px;width:8px;"></td>
                    <td class="s27a3d36e" id="print_date" colspan="6"
                        style="max-width:189px;max-height:23px;white-space:nowrap;height:23px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                    </td>
                    <td style="border:0px;height:23px;width:7px;"></td>
                </tr>
                <tr style="height:22px;">
                    <td style="border:0px;height:22px;width:8px;"></td>
                    <td class="s27a3d36e" id="print_cname" colspan="6"
                        style="max-width:189px;max-height:22px;white-space:nowrap;height:22px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                    </td>
                    <td style="border:0px;height:22px;width:7px;"></td>
                </tr>
                <tr style="height:7px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:7px;white-space:nowrap;height:7px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:4px;">
                    <td style="border:0px;height:4px;width:8px;"></td>
                    <td style="border:0px;height:4px;width:64px;"></td>
                    <td style="border:0px;height:4px;width:10px;"></td>
                    <td style="border:0px;height:4px;width:46px;"></td>
                    <td style="border:0px;height:4px;width:4px;"></td>
                    <td style="border:0px;height:4px;width:26px;"></td>
                    <td style="border:0px;height:4px;width:39px;"></td>
                    <td style="border:0px;height:4px;width:7px;"></td>
                </tr>
                <tr style="height:31px;">
                    <td class="scf592fe8" colspan="3"
                        style="max-width:82px;max-height:31px;white-space:nowrap;height:31px;width:82px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        商品名称
                    </td>
                    <td class="scf592fe8"
                        style="white-space:nowrap;height:31px;width:46px;max-height:31px;max-width:46px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        单价
                    </td>
                    <td class="scf592fe8" colspan="2"
                        style="white-space:nowrap;height:31px;width:30px;max-height:31px;max-width:30px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        数量
                    </td>
                    <td class="scf592fe8" colspan="2"
                        style="white-space:nowrap;height:31px;width:46px;max-height:31px;max-width:46px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        合计
                    </td>
                </tr>
                <tbody id="goods_info_list">
                </tbody>
                <tr style="height:3px;">
                    <td style="border:0px;height:3px;width:8px;"></td>
                    <td style="border:0px;height:3px;width:64px;"></td>
                    <td style="border:0px;height:3px;width:10px;"></td>
                    <td style="border:0px;height:3px;width:46px;"></td>
                    <td style="border:0px;height:3px;width:4px;"></td>
                    <td style="border:0px;height:3px;width:26px;"></td>
                    <td style="border:0px;height:3px;width:39px;"></td>
                    <td style="border:0px;height:3px;width:7px;"></td>
                </tr>
                <tr style="height:8px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:8px;white-space:nowrap;height:8px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:22px;">
                    <td style="border:0px;height:22px;width:8px;"></td>
                    <td class="s27a3d36e"  id="print_djje" colspan="6"
                        style="max-width:189px;max-height:22px;white-space:nowrap;height:22px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                    </td>
                    <td style="border:0px;height:22px;width:7px;"></td>
                </tr>
                <tr style="height:23px;">
                    <td style="border:0px;height:23px;width:8px;"></td>
                    <td class="s27a3d36e"  id="print_sjje" colspan="6"
                        style="max-width:189px;max-height:23px;white-space:nowrap;height:23px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                    </td>
                    <td style="border:0px;height:23px;width:7px;"></td>
                </tr>
                <tr style="height:23px;">
                    <td style="border:0px;height:23px;width:8px;"></td>
                    <td class="s27a3d36e" colspan="6"
                        style="max-width:189px;max-height:23px;white-space:nowrap;height:23px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        结算方式：现金
                    </td>
                    <td style="border:0px;height:23px;width:7px;"></td>
                </tr>
                <tr style="height:23px;">
                    <td style="border:0px;height:23px;width:8px;"></td>
                    <td class="s27a3d36e"  id="print_note" colspan="6"
                        style="max-width:189px;max-height:23px;white-space:nowrap;height:23px;width:189px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                    </td>
                    <td style="border:0px;height:23px;width:7px;"></td>
                </tr>
                <tr style="height:4px;">
                    <td style="border:0px;height:4px;width:8px;"></td>
                    <td style="border:0px;height:4px;width:64px;"></td>
                    <td style="border:0px;height:4px;width:10px;"></td>
                    <td style="border:0px;height:4px;width:46px;"></td>
                    <td style="border:0px;height:4px;width:4px;"></td>
                    <td style="border:0px;height:4px;width:26px;"></td>
                    <td style="border:0px;height:4px;width:39px;"></td>
                    <td style="border:0px;height:4px;width:7px;"></td>
                </tr>
                <tr style="height:7px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:7px;white-space:nowrap;height:7px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:3px;">
                    <td style="border:0px;height:3px;width:8px;"></td>
                    <td style="border:0px;height:3px;width:64px;"></td>
                    <td style="border:0px;height:3px;width:10px;"></td>
                    <td style="border:0px;height:3px;width:46px;"></td>
                    <td style="border:0px;height:3px;width:4px;"></td>
                    <td style="border:0px;height:3px;width:26px;"></td>
                    <td style="border:0px;height:3px;width:39px;"></td>
                    <td style="border:0px;height:3px;width:7px;"></td>
                </tr>
                <tr style="height:22px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:22px;white-space:nowrap;height:22px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        欢迎下次光临
                    </td>
                </tr>
                <tr style="height:3px;">
                    <td style="border:0px;height:3px;width:8px;"></td>
                    <td style="border:0px;height:3px;width:64px;"></td>
                    <td style="border:0px;height:3px;width:10px;"></td>
                    <td style="border:0px;height:3px;width:46px;"></td>
                    <td style="border:0px;height:3px;width:4px;"></td>
                    <td style="border:0px;height:3px;width:26px;"></td>
                    <td style="border:0px;height:3px;width:39px;"></td>
                    <td style="border:0px;height:3px;width:7px;"></td>
                </tr>
                <tr style="height:8px;">
                    <td class="saa799430" colspan="8"
                        style="max-width:204px;max-height:8px;white-space:nowrap;height:8px;width:204px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">
                        ----------------------------
                    </td>
                </tr>
                <tr style="height:65px;">
                    <td style="border:0px;height:65px;width:8px;"></td>
                    <td style="border:0px;height:65px;width:64px;"></td>
                    <td style="border:0px;height:65px;width:10px;"></td>
                    <td style="border:0px;height:65px;width:46px;"></td>
                    <td style="border:0px;height:65px;width:4px;"></td>
                    <td style="border:0px;height:65px;width:26px;"></td>
                    <td style="border:0px;height:65px;width:39px;"></td>
                    <td style="border:0px;height:65px;width:7px;"></td>
                </tr>
                <tr style="height:1px;">
                    <td style="border:0px;height:1px;width:8px;"></td>
                    <td style="border:0px;height:1px;width:64px;"></td>
                    <td style="border:0px;height:1px;width:10px;"></td>
                    <td style="border:0px;height:1px;width:46px;"></td>
                    <td style="border:0px;height:1px;width:4px;"></td>
                    <td style="border:0px;height:1px;width:26px;"></td>
                    <td style="border:0px;height:1px;width:39px;"></td>
                    <td style="border:0px;height:1px;width:7px;"></td>
                </tr>
            </table>
        </div>
    </div>

    <script type="text/javascript" charset="utf-8" src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>
    <script>
        var height = document.body.clientHeight - 237;
        height = parseInt(height);
        document.getElementById("gb_list").style.height = height + "px";
        document.getElementById("gl_list").style.height = height + "px";

        var unit_id = '';
        var check_status = 1;

        function showUnit(id) {
            check_status = 1;
            $('#el-popover-3788').hide();
            $('.goods_unit').hide();
            $('.goods_attr').hide();
            $('.goods_unit' + id).show();
        }

        function showAttr(id, u_id,unit_id='') {
            check_status = 1;
            $('#el-popover-3788').hide();
            unit_id = u_id;

            if(unit_id!==''){
                $('.gui_lists').hide();
                $('.gui_list'+unit_id).show();
            }else{
                $('.gui_lists').show();
            }

            $('.goods_unit').hide();
            $('.goods_attr').hide();
            $('.goods_attr' + id).show();
        }

        var goods_list = [];

        function addGoods(goods_name, goods_code, u_id, attr_id, price, more_unit, goods_id = '', field = '',unit_name='') {
            check_status = 1;doPrints = 1;
            $('#el-popover-3788').hide();
            if (more_unit == '1' && unit_id != '') {
                u_id = unit_id;
            }
            if(unit_name!==''){
                console.log(unit_name);
            }

            $('.goods_unit').hide();
            $('.goods_attr').hide();
            if (goods_id != '') {
                $('.' + field + goods_id).show();
            }
            var row = [];
            row['goods_name'] = goods_name;
            row['goods_code'] = goods_code;
            row['u_id'] = u_id;
            row['attr_id'] = attr_id;
            row['price'] = price;
            row['number'] = 1;
            if (goods_list.length > 0) {
                var edit_status = false;
                var key = 0;
                $(goods_list).each(function (k, v) {
                    if (v.goods_code == row.goods_code) {
                        if (v.u_id == row.u_id) {
                            if (row.attr_id != '') {
                                if (row.attr_id == v.attr_id) {
                                    edit_status = true;
                                    key = k;
                                }
                            } else {
                                edit_status = true;
                                key = k;
                            }
                        }
                    }
                });
                if (edit_status) {
                    goods_list[key]['number'] = goods_list[key]['number'] - (-row.number);
                } else {
                    goods_list.push(row)
                }
            } else {
                goods_list.push(row)
            }
            initGoods();
        }

        //初始化商品信息
        function initGoods() {
            check_status = 1;
            if (goods_list.length > 0) {
                var html = '';
                var number = 0;
                var money = 0;
                $(goods_list).each(function (k, v) {
                    html += '<tr class="gb_list_info_tr">' +
                        '       <td onclick="showGoodsInfo(\'' + k + '\')">' + v.goods_name + '</td><td onclick="showGoodsInfo(\'' + k + '\')">' + v.number + '</td><td onclick="showGoodsInfo(\'' + k + '\')">' + v.price + '</td><td><span onclick="delGoods(\'' + v.goods_code + '\',\'' + v.u_id + '\',\'' + v.attr_id + '\')"><i class="layui-icon">&#xe640;</i></span></td>' +
                        '    </tr>';
                    number = number - (-v.number);
                    money = money - (-(v.number * v.price));
                });
                number = parseFloat(number);
                money = parseFloat(money);
                $('#gb_list_info').html(html);
                $('.gb_count_number').html(number);
                $('.gb_count_price').html(money + '元');
            } else {
                $('#gb_list_info').html('');
                $('.gb_count_number').html(0);
                $('.gb_count_price').html('0元');
            }
        }

        //删除单个商品信息
        function delGoods(goods_code, u_id, attr_id) {
            if (goods_list.length > 0) {
                var edit_status = false;
                var key = 0;
                $(goods_list).each(function (k, v) {
                    if (v.goods_code == goods_code) {
                        if (v.u_id == u_id) {
                            if (attr_id != '') {
                                if (attr_id == v.attr_id) {
                                    edit_status = true;
                                    key = k;
                                }
                            } else {
                                edit_status = true;
                                key = k;
                            }
                        }
                    }
                });
                if (edit_status) {
                    goods_list.splice(key, 1);
                }
            }
            initGoods();
        }

        //清除商品信息
        function cancelGoods() {
            goods_list = [];
            initGoods();
        }

        //挂单
        var hang = [];

        function hanging() {
            check_status = 1;doPrints = 1;
            $('#el-popover-3788').hide();
            $('#el-popover-8738').hide();
            var customers_id = $('#customers_id').val();
            if (customers_id == '') {
                Toastr.error('请选择客户');
            } else if (goods_list.length <= 0) {
                Toastr.error('请选择商品数据');
            } else {
                var customers_name = $('#customers_name').val();
                var row = [];
                var myDate = new Date();
                row.id = 'NO.' + (hang.length - (-1));
                row.time = myDate.getHours() + ':' + myDate.getMinutes() + ':' + myDate.getSeconds();
                row.customers_id = customers_id;
                row.customers_name = customers_name;
                row.goods = goods_list;
                hang.push(row);
                goods_list = [];
                initGoods();
            }
        }

        function hanged() {
            check_status = 1;
            var height = document.body.clientHeight - 105;
            var html = '';
            if (hang.length == 0) {
                html = '<li style="text-align: center">暂无源单</li>';
            } else {
                $(hang).each(function (k, v) {
                    html += '<li data-v-94c2cff2="" class="pendFocus">\n' +
                        '                <span data-v-94c2cff2="" class="addyuan" data-id="' + v.id + '">' + v.id + ' - ' + v.time + '</span>\n' +
                        '                <i class="layui-icon delyuan" data-id="' + v.id + '">&#xe640;</i>\n' +
                        '            </li>';
                })
                height = height - (32 * (hang.length - 1))
                heights = hang.length * 32 - (-15);
                document.getElementById("el-popover-3788").style.height = heights + "px";
            }
            document.getElementById("el-popover-3788").style.top = height + "px";
            $('.pendList').html(html);
            $('#el-popover-3788').show();
        }

        var goods_k = '';

        function showGoodsInfo(k) {
            check_status = 1;
            goods_k = k;
            goods_info = goods_list[k];
            $('#goods_name').val(goods_info.goods_name);
            $('#goods_price').val(goods_info.price);
            $('#goods_number').val(goods_info.number);
            var all_money = goods_info.price * goods_info.number;
            $('#all_money').val(all_money);
            $('.vposModal').show();
            $('#el-popover-8738').show();
        }

        $('#goods_price').change(function () {
            var price = $('#goods_price').val();
            var number = $('#goods_number').val();
            price = parseFloat(price);
            number = parseFloat(number);
            if (!isNaN(price) && !isNaN(number) && goods_k !== '') {
                var all_money = price * number;
                $('#all_money').val(all_money);
                goods_list[goods_k].number = number;
                goods_list[goods_k].price = price;
                initGoods();
            }
        });
        $('#goods_number').change(function () {
            var price = $('#goods_price').val();
            var number = $('#goods_number').val();
            price = parseFloat(price);
            number = parseFloat(number);
            if (!isNaN(price) && !isNaN(number) && goods_k !== '') {
                var all_money = price * number;
                $('#all_money').val(all_money);
                goods_list[goods_k].number = number;
                goods_list[goods_k].price = price;
                initGoods();
            }
        });

        function checkouts() {
            doPrints = 1;
            $('#el-popover-3788').hide();
            $('#el-popover-8738').hide();
            var customers_id = $('#customers_id').val();
            if (customers_id == '') {
                layer.msg('请选择客户');
                return;
            } else if (goods_list.length <= 0) {
                layer.msg('请选择商品数据');
                return;
            }
            if (check_status == 2) {
                var goods_data = [];
                var money = 0;
                $(goods_list).each(function (k, v) {
                    var row = {};
                    row.goods_code = v.goods_code;
                    row.goods_unit = v.u_id;
                    row.goods_attr = v.attr_id;
                    row.number = v.number;
                    row.price = v.price;
                    money = money + (v.number * v.price);
                    goods_data.push(row);
                });
                var goods_lists = goods_list;

                var account_s = $('.account_s').val();
                var note = $('#note').val();
                var all_money = $('.paymentMoney').val();
                if (all_money == '') {
                    layer.msg('请输入收款金额');
                    return;
                }
                all_money = parseFloat(all_money);
                if (all_money < money) {
                    layer.msg('实际收金额小于应收金额');
                    return;
                }
                goods_datas = JSON.stringify(goods_data);
                $.ajax({
                    url: "{:url('add')}",
                    type: "POST",
                    data: {
                        'customers_id': customers_id,
                        'types': 'ls',
                        'all_money': all_money,
                        'account_id': account_s,
                        'note': note,
                        goods_list: goods_datas
                    },
                    success: function (res) {
                        var order_money = $('.order_money2').val()
                        var order_moneys = $('.order_moneys').val()
                        var paymentMoney = $('.paymentMoney').val()
                        var give_change = $('#give_change').html()
                        layer.closeAll();
                        if (res.code == 1) {
                            goods_list = [];
                            initGoods();

                            $('#djje').html(order_money);
                            $('#sjje').html(order_moneys);
                            $('#skje').html(paymentMoney);
                            $('#zlje').html(give_change);
                            var data = JSON.parse(res.data);
                            $('#purchase_code').html(data.purchase_code);
                            var html = $('#success_text').html();

                            $('#print_code').html(data.purchase_code);
                            $('#print_date').html('单据日期：'+data.date);
                            $('#print_cname').html('客户名称：'+data.cname);
                            var htmls = '';
                            $(goods_lists).each(function (k,v) {
                                var goods_money = v.price*v.number;
                                htmls += '<tr style="height:31px;">\n' +
                                    '                <td class="s17c57782" colspan="3"\n' +
                                    '                    style="max-width:82px;max-height:31px;word-wrap:break-word;height:31px;width:82px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">\n' +
                                    '                    '+v.goods_name+'\n' +
                                    '                </td>\n' +
                                    '                <td class="s17c57782"\n' +
                                    '                    style="max-width:46px;max-height:31px;word-wrap:break-word;height:31px;width:46px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">\n' +
                                    '                    '+v.price+'\n' +
                                    '                </td>\n' +
                                    '                <td class="s17c57782" colspan="2"\n' +
                                    '                    style="word-wrap:break-word;height:31px;width:30px;max-height:31px;max-width:30px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">\n' +
                                    '                    '+v.number+'\n' +
                                    '                </td>\n' +
                                    '                <td class="s17c57782" colspan="2"\n' +
                                    '                    style="max-width:46px;max-height:31px;word-wrap:break-word;height:31px;width:46px;overflow:hidden;text-overflow:clip;box-sizing:border-box;">\n' +
                                    '                    '+goods_money+'\n' +
                                    '                </td>\n' +
                                    '            </tr>'
                            });
                            $('#goods_info_list').html(htmls);
                            $('#print_djje').html('单据金额：'+order_money);
                            $('#print_sjje').html('实际金额：'+order_moneys);
                            $('#print_note').html('备注信息：'+note);
                            doPrints = 2;
                            layer.open({
                                type: 1,
                                title: '结账',
                                offset: '200px',
                                skin: 'layui-layer-rim', //加上边框
                                area: ['650px', '330px'], //宽高
                                content: html,
                                cancel: function () {
                                    console.log('关闭结账');
                                    check_status = 1;
                                }
                            });
                        } else {
                            check_status = 1;
                            Toastr.error(res.msg);
                        }
                    }
                });

            } else {
                if (goods_list.length <= 0) {
                    layer.msg('商品数据错误');
                    return;
                }
                if (goods_list.length > 0) {
                    var money = 0;
                    $(goods_list).each(function (k, v) {
                        money = money - (-(v.number * v.price));
                    });
                    money = parseFloat(money);
                    $('.order_money').val(money);
                    $('#order_money').html(money);
                }
                check_status = 2;
                $('#js_div').click();
            }
        }

        document.addEventListener("keydown", (function (t) {
            var a = t.keyCode;
            if (a == 118 || a == 119 || a == 120 || a == 13) {
                event.returnValue = false;
            }
        }));

        var doPrints = 1;
        function keyUp(e) {
            var currKey = 0, e = e || event;
            currKey = e.keyCode || e.which || e.charCode;
            var keyName = String.fromCharCode(currKey);
            if (currKey == 118) {
                hanging()
            }
            if (currKey == 119) {
                hanged()
            }
            if (currKey == 120) {
                checkouts()
            }
            if (currKey == 121) {
                if(doPrints==2){
                    doPrint()
                }
            }
            if (currKey == 27) {
                layer.closeAll();
            }
        }

        document.onkeyup = keyUp;

        function doPrint(){
            var obj = document.getElementById('stiJsViewerPage');
            var new_iframe = document.createElement('IFRAME');
            var doc = null;
            new_iframe.setAttribute('style', 'width:0px;height:0px;position:absolute;left:-2000px;top:-2000px;');
            new_iframe.setAttribute('align', 'left');
            document.body.appendChild(new_iframe);
            doc = new_iframe.contentWindow.document;
            doc.write('<div style="width:100%;height:auto;min-width:1100px;margin:0px auto;"align="left">'+obj.innerHTML+'</div>');
            doc.close();
            new_iframe.contentWindow.focus();
            new_iframe.contentWindow.print();
            //document.body.removeChild(iframe);
        }
    </script>
</div>